package com.samsung.app;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnKeyListener;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.Window;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import java.util.Timer;
import java.util.TimerTask;

public class PlayBack extends Activity
{
  private static final int DISPLAY_IMAGE = 1;
  private static final int DISPLAY_MSG = 3;
  private static final int DISPLAY_POPUP = 4;
  private static final int DISPLAY_SAVE = 2;
  private static final int MSGBOX_DSC_DOWN = 2;
  private static final int RUN_EXIT = 5;
  public static boolean bimagedisplay;
  private static boolean bpopup;
  private static int displaytype;
  private static Handler mHandler = new Handler();
  private static ProgressDialog prosave;
  private static Runnable r;
  private final int CLOSE_TIME = 5;
  private final int MSGBOX_QUESTIONSAVE = 1;
  private boolean bclickflag = false;
  private ImageView full;
  private ImageButton liveshutter_button;
  private Timer mTimer = null;
  private int nCheckCount = 0;
  private int orientation;
  private ImageView photo;
  private ImageView playback;
  private ImageButton save_button;
  private TimerTaskRun timetask;

  static
  {
    bpopup = false;
    bimagedisplay = false;
  }

  private void Createchanged()
  {
    setContentView(2130903043);
    this.save_button = ((ImageButton)findViewById(2131099685));
    this.liveshutter_button = ((ImageButton)findViewById(2131099686));
    this.playback = ((ImageView)findViewById(2131099684));
    this.photo = ((ImageView)findViewById(2131099683));
    this.full = ((ImageView)findViewById(2131099682));
    this.full.setOnClickListener(new ShowrDisplayListener(this.full));
    this.nCheckCount = 0;
    imagedisplay(true);
    ImageDisplay();
    this.save_button.setOnTouchListener(new View.OnTouchListener()
    {
      public boolean onTouch(View paramView, MotionEvent paramMotionEvent)
      {
        switch (paramMotionEvent.getAction())
        {
       
        case 0:
            PlayBack.this.nCheckCount = 0;
            PlayBack.this.imagedisplay(true);
            PlayBack.this.save_button.setImageResource(2130837577);
            return true;
        case 1:
            PlayBack.this.save_button.setImageResource(2130837576);
            PlayBack.this.nCheckCount = 0;
            PlayBack.this.imagedisplay(true);
            PlayBack.this.showDialog(1);
            return true;
        default:
            return false;
        }
      }
    });
    this.liveshutter_button.setOnTouchListener(new View.OnTouchListener()
    {
      public boolean onTouch(View paramView, MotionEvent paramMotionEvent)
      {
        switch (paramMotionEvent.getAction())
        {
        case 0:
            PlayBack.this.nCheckCount = 0;
            PlayBack.this.imagedisplay(true);
            PlayBack.this.liveshutter_button.setImageResource(2130837524);
            return true;
        case 1:
            PlayBack.this.liveshutter_button.setImageResource(2130837523);
            PlayBack.this.nCheckCount = 0;
            PlayBack.this.imagedisplay(true);
            PlayBack.this.backLiveShutter(1);
            return true;
        default:
            return false;
        }
      }
    });
  }

  public static void DisplayPopup()
  {
    displaytype = 4;
    mHandler.postDelayed(r, 500L);
  }

  private void ImageDisplay()
  {
    if (LiveShutter.bmImg != null)
    {
      if (this.orientation != 2)
        break label205;
      if (!"ssdp:rotationD".equals(LiveShutter.cam_rotated_type))
        break/** label97**/;
      Bitmap localBitmap6 = Bitmap.createScaledBitmap(LiveShutter.bmImg, LiveShutter.nHolder533, LiveShutter.nHolder320, true);
      this.photo.setImageBitmap(localBitmap6);
      RelativeLayout.LayoutParams localLayoutParams4 = (RelativeLayout.LayoutParams)this.photo.getLayoutParams();
      localLayoutParams4.leftMargin = 0;
      localLayoutParams4.topMargin = 0;
      localLayoutParams4.width = -1;
      localLayoutParams4.height = -1;
      this.photo.setLayoutParams(localLayoutParams4);
    }
    while (true)
    {
      return;
      label97: Bitmap localBitmap4 = Bitmap.createScaledBitmap(LiveShutter.bmImg, LiveShutter.nHolder320, LiveShutter.nHolder196, true);
      if ("ssdp:rotationL".equals(LiveShutter.cam_rotated_type));
      for (Bitmap localBitmap5 = rotate(localBitmap4, -90); ; localBitmap5 = rotate(localBitmap4, 90))
      {
        this.photo.setImageBitmap(localBitmap5);
        RelativeLayout.LayoutParams localLayoutParams3 = (RelativeLayout.LayoutParams)this.photo.getLayoutParams();
        localLayoutParams3.leftMargin = LiveShutter.nCanvasX;
        localLayoutParams3.topMargin = 0;
        localLayoutParams3.width = -2;
        localLayoutParams3.height = -2;
        this.photo.setLayoutParams(localLayoutParams3);
        break;
      }
      /**label205: **/if (("ssdp:rotationL".equals(LiveShutter.cam_rotated_type)) || ("ssdp:rotationR".equals(LiveShutter.cam_rotated_type)))
      {
        Bitmap localBitmap1 = Bitmap.createScaledBitmap(LiveShutter.bmImg, LiveShutter.nHolder533, LiveShutter.nHolder320, true);
        if ("ssdp:rotationL".equals(LiveShutter.cam_rotated_type));
        for (Bitmap localBitmap2 = rotate(localBitmap1, -90); ; localBitmap2 = rotate(localBitmap1, 90))
        {
          this.photo.setImageBitmap(localBitmap2);
          RelativeLayout.LayoutParams localLayoutParams1 = (RelativeLayout.LayoutParams)this.photo.getLayoutParams();
          localLayoutParams1.leftMargin = 0;
          localLayoutParams1.topMargin = 0;
          localLayoutParams1.width = -1;
          localLayoutParams1.height = -1;
          this.photo.setLayoutParams(localLayoutParams1);
          break;
        }
      }
      Bitmap localBitmap3 = Bitmap.createScaledBitmap(LiveShutter.bmImg, LiveShutter.nHolder320, LiveShutter.nHolder196, true);
      this.photo.setImageBitmap(localBitmap3);
      RelativeLayout.LayoutParams localLayoutParams2 = (RelativeLayout.LayoutParams)this.photo.getLayoutParams();
      localLayoutParams2.leftMargin = 0;
      localLayoutParams2.topMargin = LiveShutter.nCanvasY;
      localLayoutParams2.width = -2;
      localLayoutParams2.height = -2;
      this.photo.setLayoutParams(localLayoutParams2);
    }
  }

  private void backLiveShutter(int paramInt)
  {
    LiveShutter.screentype = 1;
    this.mTimer.cancel();
    Intent localIntent = getIntent();
    localIntent.putExtra("data", paramInt);
    setResult(-1, localIntent);
    finish();
  }

  private void imagedisplay(boolean paramBoolean)
  {
    if (!paramBoolean)
    {
      this.save_button.setVisibility(8);
      this.liveshutter_button.setVisibility(8);
      this.playback.setVisibility(8);
      bimagedisplay = true;
      return;
    }
    if (!LiveShutter.bCreateDir)
      this.save_button.setVisibility(8);
    while (true)
    {
      this.liveshutter_button.setVisibility(0);
      this.playback.setVisibility(0);
      bimagedisplay = false;
      break;
      this.save_button.setVisibility(0);
    }
  }

  public static Bitmap rotate(Bitmap paramBitmap, int paramInt)
  {
    Matrix localMatrix;
    if ((paramInt != 0) && (paramBitmap != null))
    {
      localMatrix = new Matrix();
      localMatrix.setRotate(paramInt, paramBitmap.getWidth() / 2.0F, paramBitmap.getHeight() / 2.0F);
    }
    try
    {
      int i = paramBitmap.getWidth();
      int j = paramBitmap.getHeight();
      Bitmap localBitmap = Bitmap.createBitmap(paramBitmap, 0, 0, i, j, localMatrix, true);
      if (paramBitmap != localBitmap)
      {
        paramBitmap.recycle();
        paramBitmap = localBitmap;
      }
      label75: return paramBitmap;
    }
    catch (OutOfMemoryError localOutOfMemoryError)
    {
      break label75;
    }
  }

  private void savePhoto()
  {
    prosave = ProgressDialog.show(this, null, getString(2130968598), true, false);
    prosave.setOnKeyListener(new DialogInterface.OnKeyListener()
    {
      public boolean onKey(DialogInterface paramDialogInterface, int paramInt, KeyEvent paramKeyEvent)
      {
        if (paramKeyEvent.getKeyCode() == 84);
        for (int i = 1; ; i = 0)
          return i;
      }
    });
    if (!LiveShutter.SaveImageVGA())
      backLiveShutter(1);
    while (true)
    {
      return;
      new Thread(new Runnable()
      {
        public void run()
        {
          try
          {
            Thread.sleep(1500L);
            label6: PlayBack.prosave.dismiss();
            return;
          }
          catch (Exception localException)
          {
            break label6;
          }
        }
      }).start();
    }
  }

  public void onConfigurationChanged(Configuration paramConfiguration)
  {
    super.onConfigurationChanged(paramConfiguration);
    switch (paramConfiguration.orientation)
    {
    default:
    case 1:
    case 2:
    }
    while (true)
    {
      return;
      this.orientation = paramConfiguration.orientation;
      this.nCheckCount = 0;
      Createchanged();
    }
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.orientation = getResources().getConfiguration().orientation;
    requestWindowFeature(1);
    getWindow().setFlags(1024, 1024);
    getWindow().addFlags(128);
    mHandler = new Handler();
    r = new Runnable()
    {
      public void run()
      {
        switch (PlayBack.displaytype)
        {
        default:
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
        }
        while (true)
        {
          return;
          PlayBack.this.liveshutter_button.setEnabled(true);
          PlayBack.this.imagedisplay(false);
          continue;
          PlayBack.this.savePhoto();
          continue;
          String str = PlayBack.this.getString(2130968597);
          PlayBack.prosave.setMessage(str);
          continue;
          PlayBack.bpopup = true;
          PlayBack.this.bclickflag = false;
          PlayBack.displaytype = 5;
          PlayBack.mHandler.postDelayed(PlayBack.r, 3000L);
          PlayBack.this.showDialog(2);
          continue;
          PlayBack.this.backLiveShutter(2);
        }
      }
    };
    Createchanged();
    imagedisplay(true);
    bimagedisplay = false;
    this.timetask = new TimerTaskRun();
    this.mTimer = new Timer();
    this.nCheckCount = 0;
    this.mTimer.schedule(this.timetask, 0L, 1000L);
  }

  protected Dialog onCreateDialog(int paramInt)
  {
    AlertDialog localAlertDialog;
    switch (paramInt)
    {
    default:
      localAlertDialog = null;
    case 1:
    case 2:
    }
    while (true)
    {
      return localAlertDialog;
      localAlertDialog = new AlertDialog.Builder(this).setIcon(2130837575).setTitle(2130968579).setMessage(2130968587).setPositiveButton(2130968594, new DialogInterface.OnClickListener()
      {
        public void onClick(DialogInterface paramDialogInterface, int paramInt)
        {
          PlayBack.this.nCheckCount = 0;
          PlayBack.this.imagedisplay(true);
          PlayBack.this.savePhoto();
        }
      }).setNegativeButton(2130968595, new DialogInterface.OnClickListener()
      {
        public void onClick(DialogInterface paramDialogInterface, int paramInt)
        {
          PlayBack.this.nCheckCount = 0;
          PlayBack.this.imagedisplay(true);
        }
      }).create();
      continue;
      localAlertDialog = new AlertDialog.Builder(this).setIcon(2130837558).setTitle(2130968578).setMessage(2130968580).setPositiveButton(2130968592, new DialogInterface.OnClickListener()
      {
        public void onClick(DialogInterface paramDialogInterface, int paramInt)
        {
          PlayBack.bpopup = false;
          PlayBack.this.bclickflag = true;
          PlayBack.this.backLiveShutter(2);
        }
      }).setOnKeyListener(new DialogInterface.OnKeyListener()
      {
        public boolean onKey(DialogInterface paramDialogInterface, int paramInt, KeyEvent paramKeyEvent)
        {
          if ((paramInt == 84) && (paramKeyEvent.getRepeatCount() == 0));
          for (int i = 1; ; i = 0)
            return i;
        }
      }).create();
    }
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    switch (paramInt)
    {
    default:
    case 4:
    }
    while (true)
    {
      return true;
      if (bpopup)
      {
        backLiveShutter(2);
        continue;
      }
      backLiveShutter(1);
    }
  }

  public void onPause()
  {
    super.onPause();
    if (LiveShutter.screentype == 2)
    {
      if (!LiveShutter.bappclose)
      {
        if (LiveShutter.bsaveflag)
          sendBroadcast(new Intent("android.intent.action.MEDIA_MOUNTED", Uri.parse("file://" + Environment.getExternalStorageDirectory())));
        LiveShutter.screentype = 1;
        LiveShutter.appclose();
      }
      System.exit(1);
    }
  }

  class ShowrDisplayListener
    implements View.OnClickListener
  {
    final View mTarget;

    ShowrDisplayListener(View arg2)
    {
      Object localObject;
      this.mTarget = localObject;
    }

    public void onClick(View paramView)
    {
      PlayBack.this.nCheckCount = 0;
      PlayBack.this.imagedisplay(PlayBack.bimagedisplay);
    }
  }

  class TimerTaskRun extends TimerTask
  {
    TimerTaskRun()
    {
    }

    public void run()
    {
      PlayBack localPlayBack = PlayBack.this;
      localPlayBack.nCheckCount = (1 + localPlayBack.nCheckCount);
      if (PlayBack.this.nCheckCount == 5)
      {
        PlayBack.displaytype = 1;
        PlayBack.mHandler.postDelayed(PlayBack.r, 10L);
      }
      while (true)
      {
        return;
        if (PlayBack.this.nCheckCount == 65536)
        {
          PlayBack.this.nCheckCount = 6;
          continue;
        }
      }
    }
  }
}

/* Location:           C:\Users\Chris\Desktop\viewfinder\com.samsung.app-34_dex2jar.jar
 * Qualified Name:     com.samsung.app.PlayBack
 * JD-Core Version:    0.6.0
 */